<% layout('/layouts/default.html', {title: '数据管理', libs:
['validate','fileupload','ueditor','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(ztCard.isNewRecord ? '新增会员卡' :
				'编辑会员卡')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool"
					data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>
			</div>
		</div>
		
		<#form:form id="inputForm" model="${ztCard}"
		action="${ctx}/ztCard/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('会员卡信息')}</div>
			<#form:hidden path="id"/>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('会员卡名')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-5"><#form:input path="name"
							maxlength="30" class="form-control required "/></div>
					</div>
				</div>
				
			
				<div class="col-xs-3">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('价格')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-6"><#form:input path="price" id="price"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			
				<div class="col-xs-3">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('时长')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-6"><#form:select path="monthnum" 
							dictType="zt_card_type" blankOption="true" class="form-control required" />
						</div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('商品推广图片上传：<br/>尺寸700*1285')}</label>
						<div class="col-sm-10">
								
					


	<#form:fileupload id="upload2" returnPath="true" fileNameInputId="imgname"
							filePathInputId="img" bizKey="${ztCard.id}" bizType="user_upload2" uploadType="image"
							maxUploadNum="1"  class="required" readonly="false" isMini="false"/>
							<#form:input name="img" class="form-control required"/>
							<#form:input name="imgname" class="form-control required"/>
	
							</div>
					</div>
				</div>
			</div>
			
			<div class="form-unit" style="margin-left: 50px;">铜级掌柜用户</div>
			<div class="row">
				
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="copperOnePriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="copperTwoPriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
				
			
			<div class="form-unit" style="margin-left: 50px;">银级掌柜用户</div>
			<div class="row">
				
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="silverOnePriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="silverTwoPriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
			
			<div class="form-unit" style="margin-left: 50px;">金牌掌柜用户</div>
			<div class="row">
				
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="goldOnePriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="goldTwoPriceCard"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			

		
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('ztMsg:ztMsgData:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit">
						<i class="fa fa-check"></i> ${text('保 存')}
					</button>
					&nbsp; <% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel"
						onclick="js.closeCurrentTabPage()">
						<i class="fa fa-reply-all"></i> ${text('关 闭')}
					</button>
				</div>
			</div>
		</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$(function() {

	//原价
	$("#price").on('blur',function(){
		var origPrice = $("#price").val();
		var copperOnePriceCard=${ztSk.copperOnePriceCard};
		var copperTwoPriceCard=${ztSk.copperTwoPriceCard};
		var silverOnePriceCard=${ztSk.silverOnePriceCard};
		var silverTwoPriceCard=${ztSk.silverTwoPriceCard};
		var goldOnePriceCard=${ztSk.goldOnePriceCard};
		var goldTwoPriceCard=${ztSk.goldTwoPriceCard};
		
		  $("input[name='copperOnePriceCard']").val(((copperOnePriceCard)*origPrice).toFixed(2));
		  $("input[name='copperTwoPriceCard']").val(((copperTwoPriceCard)*origPrice).toFixed(2));
	
		  $("input[name='silverOnePriceCard']").val(((silverOnePriceCard)*origPrice).toFixed(2));
		  $("input[name='silverTwoPriceCard']").val(((silverTwoPriceCard)*origPrice).toFixed(2));
	
		  $("input[name='goldOnePriceCard']").val(((goldOnePriceCard)*origPrice).toFixed(2));
		  $("input[name='goldTwoPriceCard']").val(((goldTwoPriceCard)*origPrice).toFixed(2));

	});
});

	$("#inputForm").validate({
		submitHandler : function(form) {
			js.ajaxSubmitForm($(form), function(data) {
				js.showMessage(data.message);
				if (data.result == Global.TRUE) {
					js.closeCurrentTabPage(function(contentWindow) {
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
</script>